package com.hsgene.order.dto;

import org.apache.commons.lang.StringUtils;
import org.apache.logging.log4j.util.Strings;

import java.util.stream.Collectors;
import java.util.stream.Stream;

/**
 * @author wangbing
 * @version 1.0
 * @date 2019/2/1 16:08
 * Copyright: Copyright (c) 2019
 */
public class SelectForInsertDoctorOrderModel {

    private String cancerId = Strings.EMPTY;

    private String drugName = Strings.EMPTY;

    private String sampleType = Strings.EMPTY;

    private String therapyType = Strings.EMPTY;

    private String geneticLocus = Strings.EMPTY;

    public void trim() {
        if (StringUtils.isNotBlank(cancerId)) {
            cancerId = trim(cancerId);
        }
        if (StringUtils.isNotBlank(drugName)) {
            drugName = trim(drugName);
        }
        if (StringUtils.isNotBlank(sampleType)) {
            sampleType = trim(sampleType);
        }
        if (StringUtils.isNotBlank(therapyType)) {
            therapyType = trim(therapyType);
        }
        if (StringUtils.isNotBlank(geneticLocus)) {
            geneticLocus = trim(geneticLocus);
        }
    }

    private String trim(String data) {
        return Stream.of(data.split(",")).distinct().collect(Collectors.joining(","));
    }

    public String getCancerId() {
        return cancerId;
    }

    public void setCancerId(String cancerId) {
        this.cancerId = cancerId;
    }

    public String getDrugName() {
        return drugName;
    }

    public void setDrugName(String drugName) {
        this.drugName = drugName;
    }

    public String getSampleType() {
        return sampleType;
    }

    public void setSampleType(String sampleType) {
        this.sampleType = sampleType;
    }

    public String getTherapyType() {
        return therapyType;
    }

    public void setTherapyType(String therapyType) {
        this.therapyType = therapyType;
    }

    public String getGeneticLocus() {
        return geneticLocus;
    }

    public void setGeneticLocus(String geneticLocus) {
        this.geneticLocus = geneticLocus;
    }
}
